package ifmo.group5512.timer.client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * Created with IntelliJ IDEA. User: katerina Date: 06.11.12 Time: 14:19 To
 * change this template use File | Settings | File Templates.
 */
public class Client {

	private static void testFunc() throws UnknownHostException, IOException {
		Socket s = new Socket("127.0.0.1", 18080);
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				s.getInputStream()));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
				s.getOutputStream()));

		writer.write("BO\n");
		writer.flush();

		System.out.println(reader.readLine());
		writer.write("BOend\n");
		writer.flush();
		s.close();

	}

	public static void main(String[] args) throws IOException {

		Work work = new Work("BO");

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		String str = reader.readLine();
		if (str.equals("exit")) {
			work.stopThread();
		} else if (str.equals("needwork")) {
			work.work();
		}

	}

	private static void working() {
		System.out.println("working");
	}
}
